﻿using System;
using System.Collections.Generic;
using StockTrader.BusinessService.DataContract;
using StockTrader.BusinessService.DataContract.Structure;

namespace StockTrader.DAL.IDAL
{
    public interface IHoseOrders
    {

        void BeginADOTransaction();
        void RollBackTransaction();
        void CommitADOTransaction();
        void Open(string connString);
        void Close();

        #region Insert Hose order messages

        void InsertOrderCancellation(string timestamp, string messagetype, string firm, string ordernumber, string orderentrydate, int offset);
        void InsertOrderChange(string timestamp, string messagetype, string firm, string ordernumber, string orderentrydate, string clientid, string filter, int offset);
        void InsertAdvertisement(string timestamp, string messagetype, string firm, string tradeid, string symbol, string side, long volume, string price, string board, string addcancelflag, string contact, int offset);

        void InsertOneFirmPutThroughDeal(string timestamp, string messagetype, string firm, string tradeid, string clientIdBuyer, string ClientIdSeller, string symbol, string price, string board, string dealid, string filter1, long borkerPortfolioVolBuyer, long brokerClientVolBuyer, long mutualFundVolBuyer, long brokerForeignVolBuyer, string filter2, long borkerPortfolioVolSeller, long brokerClientVolSeller, long mutualFundVolSeller, long brokerForeignVolSeller, string filter3, int offset);
        void InsertTwoFirmPutThroughDeal(string timestamp, string messagetype, string firmSeller, string tradeIDSeller, string ClientIdSeller, string contraFirmBuyer, string tradeIDBuyer, string symbol, string price, string board, string dealid, string filter1, long borkerPortfolioVolSeller, long brokerClientVolSeller, long mutualFundVolSeller, long brokerForeignVolSeller, string filter2, int offset);
        void InsertNewConditionedOrder(string timestamp, string messagetype, string firm, string tradeId, string orderNumber, string clientId, string symbol, string side, long volume, long publishedVolume, string price, string board, string filter, string portClientFlag, string filter2, int offset);

        void InsertOrderConfirmation(string timestamp, string messagetype, string firm, string orderNumber, string orderEntryDate, int offset);
        void InsertConfirmOrderCancel(string timestamp, string messagetype, string firm, long cancelshare, string ordernumber, string orderEntryDatem, string orderCancelStatus, int orderOffset);
        void InsertConfirmOrderChange(string timestamp, string messagetype, string firm, string orderNumber, string orderEntryDate, string clientId, string portClientFlag, long publishVolume, string price, string filter, int offset);
        void InsertDealConfirmation(string timestamp, string messagetype, string firm, string side, string orderNumber, string orderEntryDate, string filter, long volume, string price, string confirmNumber, int offset);
        void InsertPutThroughAcknowledgement(string timestamp, string messagetype, string firmBuyer, string tradeIdBuyer, string side, string ContraFirmSeller, string tradeIdSeller, string symbol, long volume, string price, string board, string confirmNumber, int offset);
        void InsertReject(string timestamp, string messagetype, string firm, string rejectReasonCode, string messageText, int offset);
        void InsertCrossDealConfirm(string timestamp, string messagetype, string firm, string orderNumberBuyer, string orderEntryDateBuyer, string orderNumberSeller, string orderEntryDateSeller, long volume, string price, string confirmNumber, int offset);
        void InsertPutThroughDealConfirmation(string timestamp, string messagetype, string firm, string side, string dealId, string contraFirm, long volume, string price, string confirmNumber, int offset);
        void InsertPutThroughDealReply(string timestamp, string messagetype, string firm, string confirmNumber, string dealId, string clientIdBuyer, string replyCode, string filter, long borkerPortfolioVolBuyer, long brokerClientVolBuyer, long mutualFundVolBuyer, long brokerForeignVolBuyer, string filter2, int offset);
        void InsertDealPutThroughCancelRequest(string timestamp, string messagetype, string firm, string contraFirm, string tradeId, string confirmNumber, string symbol, string side, int offset);
        void InsertDealCancelReply(string timestamp, string messagetype, string firm, string confirmNumber, string replyCode, int offset);
        #endregion

        #region Count Hose order messages

        int CountOrderCancellation();
        int CountOrderChange();
        int CountAdvertisement();

        int CountOneFirmPutThroughDeal();
        int CountTwoFirmPutThroughDeal();
        int CountNewConditionedOrder();
        int CountOrderConfirmation();
        int CountConfirmOrderCancel();
        int CountConfirmOrderChange();
        int CountDealConfirmation();
        int CountPutThroughAcknowledgement();
        int CountReject();
        int CountCrossDealConfirm();
        int CountPutThroughDealConfirmation();

        int CountPutThroughDealReply();
        int CountDealPutThroughCancelRequest();
        int CountDealCancelReply();
        #endregion

        #region Delete Hose order messages

        void DeleteOrderCancellation();
        void DeleteOrderChange();
        void DeleteAdvertisement();

        void DeleteOneFirmPutThroughDeal();
        void DeleteTwoFirmPutThroughDeal();
        void DeleteNewConditionedOrder();
        void DeleteOrderConfirmation();
        void DeleteConfirmOrderCancel();
        void DeleteConfirmOrderChange();
        void DeleteDealConfirmation();
        void DeletePutThroughAcknowledgement();
        void DeleteReject();
        void DeleteCrossDealConfirm();
        void DeletePutThroughDealConfirmation();

        void DeletePutThroughDealReply();
        void DeleteDealPutThroughCancelRequest();
        void DeleteDealCancelReply();
        #endregion

        #region Get Hose order message
        List<OrderNewData> getNewConditionedOrderData();
        List<OrderChangeData> getOrderChangeData();
        List<OrderCancelData> getOrderCancelData();
        List<OFPTDealData> getOFPTDealData();
        List<TFPTDealData> getTFPTDealData();
        List<OrderPtCancelRequestData> getOrderPtCancelRequest();        

        List<ConfirmOrderChangeData> getConfirmOrderChangeData();
        List<ConfirmCrossingDealData> getConfirmCrossingDealData();
        List<ConfirmDealData> getConfirmDealData();
        List<ConfirmOrderCancelData> getConfirmOrderCancelData();
        List<ConfirmOrderNewData> getConfirmOrderNewData();
        List<ConfirmPtDealData> getConfirmPtDealData();
        List<ConfirmPtDealCancelData> getConfirmPtDealCancelData();
        List<PtACKData> getPtACKData();
        List<PtDealReplyData> getPtDealReplyData();
        #endregion

        #region Get Hose orders backup
        List<OrderNewData> getBackupNewConditionedOrderData(DateTime from, DateTime to);
        List<OrderChangeData> getBackupOrderChangeData(DateTime from, DateTime to);
        List<OrderCancelData> getBackupOrderCancelData(DateTime from, DateTime to);
        List<OFPTDealData> getBackupOFPTDealData(DateTime from, DateTime to);
        List<TFPTDealData> getBackupTFPTDealData(DateTime from, DateTime to);
        List<OrderPtCancelRequestData> getBackupOrderPtCancelRequest(DateTime from, DateTime to);

        List<ConfirmOrderChangeData> getBackupConfirmOrderChangeData(DateTime from, DateTime to);
        List<ConfirmCrossingDealData> getBackupConfirmCrossingDealData(DateTime from, DateTime to);
        List<ConfirmDealData> getBackupConfirmDealData(DateTime from, DateTime to);
        List<ConfirmOrderCancelData> getBackupConfirmOrderCancelData(DateTime from, DateTime to);
        List<ConfirmOrderNewData> getBackupConfirmOrderNewData(DateTime from, DateTime to);
        List<ConfirmPtDealData> getBackupConfirmPtDealData(DateTime from, DateTime to);
        List<ConfirmPtDealCancelData> getBackupConfirmPtDealCancelData(DateTime from, DateTime to);
        List<PtACKData> getBackupPtACKData(DateTime from, DateTime to);
        List<PtDealReplyData> getBackupPtDealReplyData(DateTime from, DateTime to);
        #endregion


        void BackupHoseOrders();

        void DeleteHoseOrders();

        int CountBackupOrders();

        void UpdateSecuritiesInfo(int stockno, string symbol, string market);

        List<string> getVipAccount();
    }
}
